|
|
|
|
|
|
|
A combo box has a few events youll write code for. One of these events depends on the Style property of the combo box. If the Style property is set to either 0-DropDown Combo or 1-Simple Combo, the Change() event will fire. If its set to 2-DropDown List, the Change() event will not fire. |
|
|
|
|
|
|
|
|
The ComboBox_Change Event |
|
|
|
|
|
|
|
|
The Change() event will only fire if the Style property is set to 0 or 1. When the Style is set to either of these two values, the combo box can act as either a text box or a drop-down list. If the user types something into the text box portion of the combo box, the Change event will fire. You would write code in this event just like for a normal text box. |
|
|
|
|
|
|
|
|
The ComboBox_Click( ) Event |
|
|
|
|
|
|
|
|
Whenever the user changes the value in the combo box by clicking an item in the drop-down list, the Click() event is fired. You can write code to respond to the user clicking an item in the combo box. For the Employee Information form, you could write code to make the Save button enabled: |
|
|
|
 |
|
|
|
|
Private Sub cboState_Click() ()
cmdSave.Enabled = True
End Sub |
|
|
|
|
|
|
|
|
The ComboBox_DropDown( ) Event |
|
|
|
|
|
|
|
|
The DropDown() event occurs whenever the user opens the drop-down portion of the combo box. This event will only occur when the combo box Style property is set to 0-DropDown Combo or 2-DropDown List. If the Style is set to 1-Simple Combo, there is no drop-down list; therefore, this event cannot happen. You can use this event to fill the combo box with values only when the user chooses the combo box. This way, you dont have to prefill the combo box with values, which could slow down the loading of the form. |
|
|
|
|
|
|
|
|
Menus on a form only have one event associated with themthe Click() event. No other events are associated with menu items. |
|
|
|
|
|